import {
    center,
    input
} from '@/css/DialogsCss.module.scss';
export default {
    title:'新增编辑',
    dialog:{
        size:'50%'
    },
    onMounted: [{
        action:'print',
        value:'$params',
    },{
        action:'set',
        target: '$view',
        field:'title',
        value:'$params.title'
    },{
        action: 'set',
        target: '$widgets.form',
        field: 'value',
        value: '$params.form'
    }],
    items: [{
        region: 'center',
        span: 10,
        class: center,
        layout: 'vertical',
        items: [{
            layout: 'vertical',
            items: [{
                id: 'form',
                widget: 'form',
                layout: {
                    type:'gridform',
                    column:2
                },
                fields:[{
                    class: input,
                    itemId: 'code',
                    placeholder:'请输入合同编号',
                    widget:'text',
                    label:'合同编号',
                },{
                    class: input,
                    itemId: 'name',
                    placeholder:'请输入合同名称',
                    widget:'text',
                    label:'合同名称',
                },{
                    class: input,
                    itemId:'customer_uuid',
                    placeholder:'请选择客户(公司)',
                    widget:'select',
                    dictionary: 'common/dictionary/customer',
                    label:'客户名称',
                },{
                    class: input,
                    itemId: 'category_uuid',
                    placeholder:'请选择合同类型',
                    widget:'select',
                    dictionary: {
                        path: 'common/dictionary/config',
                        params: {
                            name: 'crm_contract_category',
                        },
                    },
                    label:'合同类型',
                },{
                    class: input,
                    itemId: 'status_uuid',
                    placeholder:'请选择合同状态',
                    widget:'select',
                    dictionary: {
                        path: 'common/dictionary/config',
                        params: {
                            name: 'crm_contract_status',
                        },
                    },
                    label:'合同状态',
                },{
                    class: input,
                    itemId: 'operator_uuid',
                    placeholder:'请选择创建人',
                    print:true,
                    widget:'select',
                    dictionary: 'common/dictionary/salesman',
                    label:'创建人',
                },{
                    class: input,
                    itemId: 'amount_contract',
                    placeholder:'请输入合同金额',
                    widget:'text',
                    label:'合同金额',
                },{
                    class: input,
                    itemId: 'amount_return',
                    placeholder:'请输入回款金额',
                    widget:'text',
                    label:'回款金额',
                },{
                    class: input,
                    itemId: 'amount_arrears',
                    placeholder:'请输入欠费金额',
                    widget:'text',
                    label:'欠费金额',
                },{
                    class: input,
                    itemId: 'amount_invoice',
                    placeholder:'请输入开票金额',
                    widget:'text',
                    label:'开票金额',
                },{
                    class: input,
                    itemId: 'sign_time',
                    placeholder:'请选择签订时间',
                    widget:'form-datepicker',
                    type: 'date',
                    label:'签订时间',
                },{
                    class: input,
                    itemId: 'expiration_time',
                    placeholder:'请选择到期时间',
                    widget:'form-datepicker',
                    type: 'date',
                    label:'到期时间',
                },{
                    class: input,
                    itemId: 'remarks',
                    placeholder:'请输入备注说明',
                    widget:'text',
                    label:'备注说明',
                }],
                buttons: [{
                    value: '保存',
                    type: 'primary',
                    onClick: [{
                        action: 'confirm',
                        title: '表单保存',
                        message: '是否保存表单?',
                        confirm: [{
                            var:'value',
                            target:'$widget',
                            action:'call',
                            method:'getValue'
                        },{
                            action: 'service',
                            path: 'crm/contract/save',
                            params:{
                                operator_uuid:'$params.operator_uuid',
                                '...':['$vars.value']
                            }
                        },{
                            action:'dialog-hide',
                            mode:'apply'
                        }]
                    }]
                }],
                flex: true
            }]
        }]
    }]
};


